package com.xu.provider.dao;

import com.xu.entity.pojo.Weather;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

/**
 * @author 徐老板
 * @date 2020/4/1   18:26
 */
public interface WeatherProviderDao extends JpaRepository<Weather,Integer> {

    Weather getByCityAndCdate(String city, Date cdate);

    //JPQL语言查询  获取参数的方式：?序号 从1开始 指定名称获取 :名
    @Query(value = "from Weather where city=?1")
    List<Weather> queryCity(@Param("nnn")String city);

    //原生SQL查询
//    @Query(value = "select * from t_weather where city=#{city}",nativeQuery = true)
//    List<Weather> queryCity(String city);
}
